/*	kd:
	
	This deals with text being typed on the screen, but you can use it for more.
	The idea is you might want to type, let's say, 1.5 letters every tic. That
	is just annoying to track, so... here.
	
	*/

struct Gc_RealCounter {
	private double					step;
	private int						max_amount;
	private double					amount;
	
	void To (int max_amount_, double step_ = 1.0) {
		amount		= 0;
		max_amount	= max_amount_;
		step		= step_;
	}
	
	void Next () {
		amount = min(max_amount, amount + step);
	}
	
	void BackTo (int max_amount_) {
		amount		= 0;
		max_amount	= max_amount_;
	}
	
	double RealAmount (double t = 0) const {
		return min(max_amount, amount + t * step);
	}
	
	int WholeAmount (double t = 0) const {
		return floor(RealAmount(t));
	}
	
	double RealF (double t = 0) const {
		return clamp(amount + t * step, 0, max_amount) / max_amount;
	}
	
	bool IsDone () const {
		return max_amount <= amount;
	}
}
